#ifndef PID_H
#define PID_H

class PIDController{
public:
    PIDController(float P = 0, float I = 0, float D = 0, float ramp = 0, float limit = 0);
    ~PIDController() = default;

    float operator() (float error);

    float P, I ,D;     // PID 增益
    float output_ramp; 
    float limit;       // maximum output Voltage 

protected:
    float error_prev;       // 上次的跟踪误差值 
    float output_prev;      // 上次的PID总输出
    float integral_prev;    // 上次的积分分量值
    unsigned long timestamp_prev;
};

#endif